﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

namespace welwitschia
{
    public class PaginaBase : System.Web.UI.Page
    {
        public void MostraErro(String mensagem) 
        {
            String csname2 = "JQErro";
            Type cstype = this.GetType();

            ClientScriptManager cs = Page.ClientScript;

            if (!cs.IsStartupScriptRegistered(cstype, csname2))
            {
                StringBuilder cstext1 = new StringBuilder();
                cstext1.Append("<script type=text/javascript>$(document).ready(function(){$(\"#msgErro\").html(\"" +  mensagem + "\");");
                cstext1.Append("$(\"#errorDiv\").slideToggle();});</");
                cstext1.Append("script>");


                cs.RegisterStartupScript(cstype, csname2, cstext1.ToString());
            }
        }

        public void MostraAviso(String mensagem) 
        {
            String csname2 = "JQAviso";
            Type cstype = this.GetType();

            ClientScriptManager cs = Page.ClientScript;

            if (!cs.IsStartupScriptRegistered(cstype, csname2))
            {
                StringBuilder cstext1 = new StringBuilder();
                cstext1.Append("<script type=text/javascript>$(document).ready(function(){$(\"#msgAviso\").html(\"" + mensagem + "\");");
                cstext1.Append("$(\"#alertDiv\").slideToggle();});</");
                cstext1.Append("script>");

                cs.RegisterStartupScript(cstype, csname2, cstext1.ToString());
            }
        }

        public void MostraInfo(String mensagem)
        {
            String csname2 = "JQInfo";
            Type cstype = this.GetType();

            ClientScriptManager cs = Page.ClientScript;

            if (!cs.IsStartupScriptRegistered(cstype, csname2))
            {
                StringBuilder cstext1 = new StringBuilder();
                cstext1.Append("<script type=text/javascript>$(document).ready(function(){$(\"#msgInfo\").html(\"" + mensagem + "\");");
                cstext1.Append("$(\"#infoDiv\").slideToggle();});</");
                cstext1.Append("script>");

                cs.RegisterStartupScript(cstype, csname2, cstext1.ToString());
            }
        }
       
    }
}